package com.zhiyou.serviceImpl;



import com.zhiyou.dao.RectDao;
import com.zhiyou.daoImpl.RectDaoImpl;

import com.zhiyou.model.Rect;
import com.zhiyou.service.RectService;
import com.zhiyou.util.PageBean;

public class RectServiceImpl implements RectService {

	@Override
	public PageBean<Rect> show(int pc,int ps) {
		RectDao rd = new RectDaoImpl();
		PageBean<Rect> pageBean = rd.findAll(pc, ps);
		return pageBean;
	}

	@Override
	public Rect find(int id) {
		RectDao rd = new RectDaoImpl();
		Rect rect = rd.findById(id);
		return rect;
	}

	@Override
	public boolean delete(int id) {
		RectDao rd = new RectDaoImpl();
		boolean flag = rd.delete(id);
		return flag;
	}

	@Override
	public boolean update(Object[] obj) {
		RectDao rd = new RectDaoImpl();
		boolean flag = rd.update(obj);
		return flag;
	}

	@Override
	public boolean add(Object[] obj) {
		RectDao rd = new RectDaoImpl();
		boolean flag = rd.add(obj);
		return flag;
	}

	@Override
	public boolean dels(int[] id) {
		// TODO Auto-generated method stub
		RectDao rd = new RectDaoImpl();
		int id1[] = rd.dels(id);
		for(int i = 0;i<id1.length;i++){
			if(id1[i] == 0){
				return false;
			}
		}
		return true;
	}

	@Override
	public PageBean<Rect> find(String flat, String tenant, String money, int pc, int ps) {
		RectDao rd = new RectDaoImpl();
		PageBean<Rect> pageBean = rd.find(flat, tenant, money, pc, ps);
		return pageBean;
	}

	
	
}
